'use strict'

myApp.controller('tableCtrl', function($scope,$http) {
	

	// $http
		// .post("http://192.168.137.133:8008/idea_list")
		// .success(function(data,header,config,status){
		// });

	var user_info1 = [
		{title: '医疗大数据',time: '1987-05-17',status: '发布'}, 
		{title: '丰台妇幼数据分析',time: '2987-02-13',status: '草稿'}, 
		{title: '清华大学数据分析',time: '1187-04-21',status: '垃圾箱'}, 
		{title: '中北大学数据分析',time: '1387-05-04',status: '草稿'}, 
		{title: 'NUC数据分析',time: '1917-08-15',status: '发布'}, 
		{title: '北京学数据分析',time: '1987-06-01',status: '已成型'}, 
		{title: 'GG数据分析',time: '1987-09-08',status: '垃圾箱'}, 
		{title: 'TA数据分析',time: '1987-01-23',status: '已成型'}, 
		{title: 'Tence数据分析',time: '1983-05-17',status: '发布'}, 
		{title: 'QQ数据分析',time: '1987-05-13',status: '草稿'}, 
		{title: '微信数据分析',time: '1927-06-19',status: '已成型'}, 
		{title: '大树数据分析',time: '1937-02-21',status: '发布'}, 
		{title: '模拟数据分析',time: '1387-09-08',status: '草稿'}, 
		{title: 'LOL数据分析',time: '1287-01-11',status: '垃圾箱'}, 
	];
$scope.paginationConf = {
        currentPage: 1,
        itemsPerPage: 5,
        pagesLength: 6,
        perPageOptions: [1, 5, 10, 15, 20],
        onChange: function(){
        	var getData = [{
				pageIndex: $scope.paginationConf.currentPage,
				pageSize: $scope.paginationConf.itemsPerPage
			}];

			$http({
				method: "get",
				url: "http://192.168.137.133:8008/idea_list",
				params: {
					getData: getData
				}
			}).success(function(data,header,config,status){
				// user_info = data;
				console.log(data);
				$scope.paginationConf.totalItems = data[0]["total"];
        		$scope.user_info = data[1]["data"];
			});
			// console.log(user_info)
   //      	$scope.paginationConf.totalItems = user_info.length;
   //      	$scope.user_info = user_info;
    		// $scope.user_info = user_info.slice(($scope.paginationConf.currentPage-1)*$scope.paginationConf.itemsPerPage,$scope.paginationConf.currentPage*$scope.paginationConf.itemsPerPage);
        }
    };

});
